package chess;

import comm.*;

public class ChessBoard {

	public static final int ROWS = 15;
	public static final int COLS = 15;
	public static final byte NONE = -1;
	public static final byte BLACK = 0;
	public static final byte WHITE = 1;

	public byte[][] board = new byte[ROWS][COLS];
	public byte turn;

	public ChessBoard() {
		for (int i = 0; i < ROWS; i++)
			for (int j = 0; j < COLS; j++)
				board[i][j] = NONE;
		turn = BLACK;
	}

	public void update(ChessInfo c) {
		board[c.row][c.col] = c.color;
		turn = (byte) (1 - turn);
	}

	public void print() {
		for (int i = 0; i < ROWS; i++) {
			for (int j = 0; j < COLS; j++)
				switch (board[i][j]) {
				case NONE:
					System.out.print(". ");
					break;
				case BLACK:
					System.out.print("x ");
					break;
				case WHITE:
					System.out.print("o ");
					break;
				}
			System.out.println();
		}
	}

}
